package com.xuyiwei.mayi.schedule;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Created by xuyiwei on 2019/4/23.
 */
public class ScheduleThread {
    public static void main(String[] args) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("这是定时器");
            }
        });
        ScheduledExecutorService service =   Executors.newSingleThreadScheduledExecutor();
        service.scheduleAtFixedRate(thread,0,1, TimeUnit.SECONDS);

    }
}
